﻿using System;
using System.Data.SqlClient;
using System.Runtime.Serialization;
using Devv.Core.UniDataTier;

namespace BikeBouncer.BusinessLayer.Entities
{
	[DataContract, Serializable]
	public class BlackMarket : BaseEntity
	{
		#region Properties

		[DataMember]
		public Address Address { get; set; }

		[DataMember]
		public String Title { get; set; }

		[DataMember]
		public Int32 Score { get; set; }

		#endregion

		#region Constructor

		public BlackMarket()
		{
			Address = new Address();
		}

		public BlackMarket(Int32 id)
		{
			Construct(DataAccess.BlackMarket_Get(id));
		}

		public BlackMarket(SqlDataReader reader)
		{
			Construct(reader);
		}

		#endregion

		#region Loading

		public override void Load(SqlDataReader reader)
		{
			Id = DataHandler.GetInt32(reader, "BlackMarketId");
			Title = DataHandler.GetString(reader, "BlackMarketTitle");
			Score = DataHandler.GetInt32(reader, "BlackMarketScore");
			Active = DataHandler.GetBoolean(reader, "BlackMarketActive");

			Address = new Address();
			Address.Load(reader);
		}

		#endregion
	}
}